import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_application_1/global.dart';
import 'package:flutter_application_1/utils/source_utils.dart';

class HeroTest1 extends StatefulWidget {
  @override
  _HeroTest1State createState() => _HeroTest1State();
}

class _HeroTest1State extends State<HeroTest1> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Hero 1'),
      ),
      body: Row(
        mainAxisAlignment: MainAxisAlignment.center,
        children: [
          Hero(
            tag: 'avatar',
            child: ClipRRect(
              borderRadius: BorderRadius.circular(50),
              child: Image.asset(
                ImageUtils.wrapAssets('avatar.jpg'),
                fit: BoxFit.cover,
                width: 50,
                height: 50,
              ),
            ),
          ),
          TextButton(
            onPressed: () {
              Global.routerUtils.navigateTo(
                context,
                Global.routeMap.heroTest2,
              );
            },
            child: Text('点击'),
          ),
        ],
      ),
    );
  }
}
